package com.dolphin.controller.api;

import com.dolphin.base.BaseApiController;
import com.dolphin.commons.Constants;
import com.dolphin.commons.ResponseBean;
import com.dolphin.model.Article;
import com.dolphin.service.ArticleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@Api(value = "公告相关", tags = "公告相关")
@RequestMapping("/api/notice")
public class NoticeController extends BaseApiController {

    @Autowired
    private ArticleService articleService;

    /**
     * @return com.dolphin.commons.Pager<com.carousel.model.carousel>
     * @description 轮播列表
     * @author dolphin
     */
    @GetMapping("/listNotice")
    @ApiOperation(value = "公告相关", notes = "公告相关")
    public ResponseBean listCarousel() {
        Article article = new Article();
        article.setType(Constants.ARTICLE_TYPE_NOTICE);
        article.setStatus(0);
        List<Article> notices = articleService.list(article);
        return ResponseBean.success(notices);
    }


}
